﻿-- =============================================
-- Author:		Wolf Gilbert
-- Create date: 7/16/06
-- Description:
-- Modified date: 12/14/06
-- Description:	Changed from Messenger to RuntimeServer	
-- Modified date: 5/14/08
-- Description:	Separating hostname from the endpoint	
-- =============================================
CREATE PROCEDURE [ServiceEngine].[ListEndpointsForRuntimeServerID]
	@RuntimeServerID uniqueidentifier
AS
BEGIN
	SET NOCOUNT ON;

SELECT	N.[EntityID] as EndpointID, ISNULL(RS.[HostName],'') +':'+ CAST(EP.[Port] AS NVARCHAR(16))+'/' + N.[EntityName] as URI, EP.[Port], N.EntityDescription as Description
	FROM	[ServiceEngine].RuntimeServers_Endpoints RE
	JOIN	[ServiceEngine].Names N on N.[EntityID] = RE.EndpointID and N.[EntityTypeID] = 2
	JOIN	[ServiceEngine].Endpoints EP on RE.EndpointID = EP.EndpointID
	JOIN [ServiceEngine].RuntimeServers RS on RE.RuntimeServerID = RS.RuntimeServerID	
	WHERE	RE.RuntimeServerID = @RuntimeServerID
	Order by N.[EntityName]
END


